﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Dynamics.BusinessConnectorNet;


namespace PJ.Data.Partner
{
    public abstract class PartnerAXProvider<TDataInterface>
        : ItemAXProvider<TDataInterface>, IPartnerProvider<TDataInterface>
        where TDataInterface : class, IPartnerData
    {
        protected PartnerAXProvider(IPartnerCache<TDataInterface> cache)
            : base(cache)
        {

        }
        protected override void CopyFromContainer(AxaptaContainer container, TDataInterface data)
        {
            base.CopyFromContainer(container, data);
            if (container.Count < 6)
                throw new ArgumentOutOfRangeException("container", container.Count, "should have at least 6 items");
            data.Phone = ((string)container.get_Item(5)).Trim();
            data.Address = ((string)container.get_Item(6)).Trim();
        }

    }
}
